package com.ezops.poc.validations.validators.converter;

/**
 * Converter class for converting one type to another. Apart from simple type
 * conversion it also checks if the converted type adhere to the given format.
 * <p>
 * So ideally this class should be called TypeAndFormat converter.The format can
 * be anything like (0-8 char), ("yyyy-MM-dd" format) or (*.2 decimal).
 * <p>
 * The format is represented by string as it gives us flexibility to define a
 * large variety of expressions, Though it leads to error situation as it can be
 * defined to any value which doesn't fit in our grammar. We can throw exception
 * if we don;t understand the format (fail fast technique)
 * 
 * TODO - We should work on making the format type safe in future.
 * 
 * @author vgaurav
 * 
 */
public interface ITypeConverter {

	/**
	 * Try to convert the @param value in the type the converter support and also in the given format.
	 * @param value
	 * @param format
	 * @throws ConversionException
	 */
	public abstract void tryConvert(String value, String format)
			throws ConversionException, UnknownFormatException;

}